<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'userCost.label', default: 'UserCost')}"/>
    <title>费用统计</title>
    <style>
    .table>tbody>tr>td{
        vertical-align: middle;
    }
    </style>
</head>

<body class="fixed-navbar fixed-sidebar">
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>费用统计</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                费用统计
            </h2>
        </div>
    </div>
</div>
<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="searchUserCostStatistics" class="form-horizontal" role="form" id="form">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit" onclick="text()"><i class="fa fa-search"></i>查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                            <i class="fa fa-times"></i>重置</button>
                    </div>
                    查询
                </div>
                <div class="panel-body seach-group" id="bug1">
                <div class="row">
                    <div class="form-group col-sm-4">
                        <label for="district" class="col-sm-3 control-label">操作用户</label>
                        <div class="col-sm-9">
                            <g:select class="form-control" name="user" id="user" from="${com.cindata.User.list()}" optionKey="fullName" optionValue="fullName" value="${params?.user}" noSelection="${['': '请选择操作用户']}"/>
                        </div>
                    </div>
                    <div class="form-group col-sm-4">
                        <label for="district" class="col-sm-3 control-label">操作类型</label>
                        <div class="col-sm-9">
                            <g:select class="form-control" name="fees" id="fees" from="${com.cindata.Fees.list()}" optionKey="name" optionValue="name" value="${params?.fees}" noSelection="${['': '请选择操作类型']}"/>
                        </div>
                    </div>
                    <div class="form-group col-sm-4">
                        <label for="district" class="col-sm-3 control-label">操作对象类型</label>
                        <div class="col-sm-9">
                            <g:select class="form-control" name="buildingType" id="buildingType" from="${com.cindata.dictionary.BuildingTypeDict.list()}" optionKey="name" optionValue="name" value="${params?.buildingType}" noSelection="${['': '请选择操作对象类型']}"/>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group col-sm-4">
                        <label for="district" class="col-sm-3 control-label">操作完成时间</label>
                        <div class="col-sm-9 input-daterange input-group p-r-n"  id="datepicker" style="width: 75%;">
                            <input type="text" class=" form-control " placeholder="请选择起始时间" value="${params?.finishAtStart}" name="finishAtStart" id="finishAtStart" />
                            <span class="input-group-addon">至</span>
                            <input type="text" class=" form-control " placeholder="请选择完成时间" value="${params?.finishAtEnd}" name="finishAtEnd" id="finishAtEnd" />
                        </div>
                    </div>
                </div>
            </div>
        </g:form>
    </div>
    </div>
    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                费用统计
            </div>
            <div class="panel-body ">
                <div class="table-responsive">
                    <table cellpadding="1" cellspacing="1" class=" table table-striped table-hover" id="esateTable">
                        <thead>
                        <tr>
                            <g:sortableColumn property="fullName" title="操作人"  class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="fees" title="操作类型" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="buildingType" title="操作对象类型" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="successcount" title="成功笔数" class=" col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="failedcount" title="失败笔数" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="pendingcount" title="执行中笔数" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="unitprice" title="单笔费用（元/次）" class="col-md-1 text-center" params="${params}"/>
                            <g:sortableColumn property="totalprice" title="总费用（元）" class=" col-md-1 text-center" params="${params}"/>
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${userCostStatisticsList}">
                            <tr>
                                <td class="text-center"><g:link style="color: #3498DB" action="index" params="[user: it?.id, fees: it?.fees, buildingType: it?.buildingtype, finishAtStart: params?.finishAtStart, finishAtEnd: params?.finishAtEnd]" class="firstTd">${it?.fullname}</g:link></td>
                                <td class="text-center">${it?.fees}</td>
                                <td class="text-center">${it?.buildingtype}</td>
                                <td class="text-center">${it?.successcount}</td>
                                <td class="text-center">${it?.failedcount}</td>
                                <td class="text-center">${it?.pendingcount}</td>
                                <td class="text-center">${it?.unitprice}</td>
                                <td class="text-center">${it?.totalprice >= 0 ? it?.totalprice : '--'}</td>
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate total="${userCostStatisticsListCount ?: 0}" params="${params}"/>
                </div>
            </div>
        </div>
    </div>
</div>
<g:javascript>
    $(function () {

        $('#datepicker').datepicker({
            language: 'zh-CN'
        });
        $("#datepicker").on("changeDate", function(event) {
            $("#my_hidden_input").val(
                    $("#datepicker").datepicker('getFormattedDate')
            )
        });

        $('.input-group.date').datepicker({ });
        $('.input-daterange').datepicker({ });
    });

    //重置按钮
    $("#resetBtn").click(function () {
        $("#s2id_user span:first").html("请选择操作用户");
        $("#user").val('');
        $("#s2id_fees span:first").html("请选择操作类型");
        $("#fees").val("");
        $("#s2id_buildingType span:first").html("请选择操作对象类型");
        $("#buildingType").val("");
        $("#finishAtStart").val("");
        $("#finishAtEnd").val("");
        $("#estate").val("");
    })
</g:javascript>

</body>
</html>
